
import {IsString, IsNumber, IsBoolean, IsDate, IsOptional, IsEnum, IsArray, IsNotEmpty, ArrayNotEmpty} from 'class-validator';
import { ApiProperty, OmitType, IntersectionType } from '@nestjs/swagger';
import { PagingDto } from 'src/common/dto/index';
import { CharEnum } from 'src/common/enum/index';


export class BaseCourseDto{
    @ApiProperty({required: false , description: '主键ID'})
    @IsOptional()
    @IsNumber()
    id?: number;

    @ApiProperty({required: false , description: '专业ID'})
    @IsOptional()
    @IsNumber()
    proId?: number;

    @ApiProperty({required: false , description: '课程ID'})
    @IsOptional()
    @IsNumber()
    courseId?: number;

    @ApiProperty({enum: CharEnum, required: false , description: '删除标志'})
    @IsOptional()
    @IsString()
    delFlag?: string;

    @ApiProperty({enum: CharEnum, required: false , description: '状态'})
    @IsOptional()
    @IsString()
    status?: string;

    @ApiProperty({required: false , description: '创建者'})
    @IsOptional()
    @IsString()
    createBy?: string;

    @ApiProperty({required: false , description: '创建时间'})
    @IsOptional()
    @IsString()
    createTime?: string;

    @ApiProperty({required: false , description: '更新者'})
    @IsOptional()
    @IsString()
    updateBy?: string;

    @ApiProperty({required: false , description: '更新时间'})
    @IsOptional()
    @IsString()
    updateTime?: string;

    @ApiProperty({required: false , description: '备注'})
    @IsOptional()
    @IsString()
    remark?: string;

}

export class CreateCourseDto extends OmitType(BaseCourseDto, [ 'id', 'delFlag']){
    @ApiProperty({required: false , description: '课程ID数组'})
    @ArrayNotEmpty({ message: '课程ID数组不能为空' })
    courseIds: number[];

    @ApiProperty({required: true , description: '专业ID'})
    @IsNotEmpty({ message: '专业ID不能为空' })
    proId: number;



}

export class UpdateCourseDto extends OmitType(BaseCourseDto, [ 'delFlag', 'createBy', 'createTime']){}

export class QueryCourseDto extends IntersectionType( BaseCourseDto, PagingDto){}

export class ListCourseDto  extends OmitType(BaseCourseDto, [ 'delFlag', 'createBy', 'createTime', 'updateBy', 'updateTime']) {}

